package org.example.carplatoon.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.example.carplatoon.entity.carPlatoon;
import org.example.carplatoon.mapper.carPlatoonMapper;
import org.example.carplatoon.service.carPlatoonService;
import org.springframework.stereotype.Service;

@Service
public class carPlatoonServiceImpl extends ServiceImpl<carPlatoonMapper, carPlatoon> implements carPlatoonService {

    /**
     * 返回状态为status的车队总数
     * @param status
     * @return
     */
    @Override
    public Integer sumOfPlatoon(int status) {
        LambdaQueryWrapper<carPlatoon> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.eq(carPlatoon::getStatus, status);
        return this.count(queryWrapper);
    }
}
